import { loginApi } from '@/api/user'
const state = {
  token: ''
}

const mutations = {
  setToken(state, data) {
    state.token = data
  }
}

const actions = {
  async login(store, data) {
    const res = await loginApi(data)
    store.commit('setToken', res.data.data)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
